<template>
  <div class="toast">
    <i :class="`icon-toast-${status} iconfont`"></i>
    <span>{{msg}}</span>
  </div>
</template>

<script>
import {mapState} from 'vuex'

export default {
  data () {
    return {

    }
  },
  computed:{
    ...mapState({
      msg:state => state.toastStatus.msg,
      status:state => state.toastStatus.status
    })
  }
}
</script>

<style lang="less" scoped>
.toast {
  position: fixed;
  left: 50%;
  top: 0;
  transform: translate(-50%);
  background: #fff;
  padding: 10px 20px;
  border-radius: 5px;
  box-shadow: 0 0 10px #fff;
  i {
    margin-right: 5px;
  }
  .icon-toast-warning {
    color: orange;
  }
  .icon-toast-success{
    color: forestgreen;
  }
  .icon-toast-danger{
    color: red;
  }
}
</style>